// ==================================================================================
// Shared Genomics Project MPI Codebase
// Version 1.0 30/04/2010
//
// (c) 2010 University of Manchester all rights reserved
//
// This file is distributed under the GNU General Public License, Version 2.  
// Please see the file COPYING.txt for more details
// ==================================================================================

/*!
\file
\brief Main Body of the EXAMPLES application
*/
/*!
\defgroup examples Examples
\brief Example MPI Invocation of SNP Analysis Programs
\details
<p>The example programs emulate the protocol needed to invoke statistical
MPI programs on a cluster.
</p>
<p>Examples code demonstrating the call order to the programs is found in the file
\ref examples.c. Functions demonstrating how to format MPIEXEC calls are found
in \ref commands.c.</p>

<p>The epistasis programs echo the permutation number to STDOUT.
To suppress this status message, remove the pre-processor directive ECHO_PERMUTATION
from a project definition and re-compile.</p>

<p>
To run the examples, build the solution, then open a console window and change
directory into the folder 'working' and type 'run' at the prompt.
On an up to date lap-top, it takes about 3-4 minutes to run all of the examples.
If you wish to only run single examples, comment out the appropriate 'Add Test'
statement in %main() of the example program.
</p>
*/

#include <stdio.h>
#include <stdlib.h>
#include <Basic.h>

#include "examples.h"

/*!
\brief Main Body of the Examples Program
\ingroup examples
*/
int main(void) {
	CU_pSuite examples = NULL;

	if (CUE_SUCCESS !=  CU_initialize_registry()) return CU_get_error();
	examples = CU_add_suite("Shared Genomics Project - Examples", NULL, NULL);

	// Comment out individual examples if you do not want to run them all.
	CU_add_test(examples, "Binary Encoding an Allelic Data-set", ex_0001_binary_encoding_dataset);
	CU_add_test(examples, "Filtering a binary encoded Data-set (BT, SNP major)", ex_0002_filtering_binary_encoding_dataset_s);
	CU_add_test(examples, "Filtering a binary encoded Data-set (BT, Individual major)", ex_0003_filtering_binary_encoding_dataset_i);
	CU_add_test(examples, "Filtering a binary encoded Data-set (QT, SNP major)", ex_0004_filtering_binary_encoding_dataset_s);
	CU_add_test(examples, "Filtering a binary encoded Data-set (QT, Individual major)", ex_0005_filtering_binary_encoding_dataset_i);
	CU_add_test(examples, "Single Association Scan (BT)", ex_0006_association_scan_bt);
	CU_add_test(examples, "Single Association Scan (BT, Emulating Processor Failure)", ex_0007_association_scan_bt_ft);
	CU_add_test(examples, "Single Association Scan (QT, Emulating Processor Failure)", ex_0008_association_scan_qt_ft);
	CU_add_test(examples, "Model Association Scan (BT, Genotypic, Emulating Processor Failure)", ex_0009_model_association_ft);
	CU_add_test(examples, "Fast Epistasis (BT, N-cores, No permutation)", ex_0010_fast_epistasis_bt);
	CU_add_test(examples, "Fast Epistasis with permutation (BT, N-cores, SNP Major)", ex_0011_fast_epistasis_bt_with_permutation);
	CU_add_test(examples, "Stratified Association (BT, N-cores, SNP Major, PCMH)", ex_0012_stratified_assoc_scan_bt);
	CU_add_test(examples, "Slow Epistasis (BT, N-cores, No permutation, Individual Major)", ex_0013_slow_epistasis_bt);
	CU_add_test(examples, "Slow Epistasis with permutation (BT, N-cores, Individual Major)", ex_0014_slow_epistasis_bt_with_permutation); 
	CU_add_test(examples, "Slow Epistasis (QT, N-cores, Individual Major)", ex_0015_slow_epistasis_qt);
	CU_add_test(examples, "Slow Epistasis with permutation (QT, N-cores, Individual Major)", ex_0016_slow_epistasis_qt_with_permutation);
	
	// Run the examples
	CU_basic_set_mode(CU_BRM_VERBOSE);
	CU_basic_run_tests();
	CU_cleanup_registry();

	return CU_get_error();
}